/**
 * Created by zjy on 16-2-25.
 */
var mongodb = require('./mongodb').db;
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var UserSchema = new Schema({
    stu_number: String,
    username: String,
    create_at: { type : Date, default: Date.now },
    update_at: { type : Date},
    delete_at: { type : Date}
});
var UserModel = mongodb.model("gw_user", UserSchema);
var UserDAO = function(){};

UserDAO.prototype.save = function(data) {
    var instance = new UserModel(data);
    return instance.save();
};

UserDAO.prototype.findOne = function(t_no) {
    return UserModel.findOne({ stu_number: t_no});
};

module.exports = new UserDAO();